package day1106.Example;

import java.util.Objects;

//汽车  父类
public class Car {
    private String type;//类型
    private String brand;//品牌
    private String carnumber;//车牌号
    private int seatnum;//座位数
    private double rent;//租金
    private boolean state;//状态

    public Car(String type, String brand, String carnumber, int seatnum, double rent , boolean state) {
        this.type = type;
        this.brand = brand;
        this.carnumber = carnumber;
        this.seatnum = seatnum;
        this.rent = rent;
        this.state = state;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getCarnumber() {
        return carnumber;
    }

    public void setCarnumber(String carnumber) {
        this.carnumber = carnumber;
    }

    public int getSeatnum() {
        return seatnum;
    }

    public void setSeatnum(int seatnum) {
        this.seatnum = seatnum;
    }

    public double getRent() {
        return rent;
    }

    public void setRent(double rent) {
        this.rent = rent;
    }

    public boolean isState() {
        return state;
    }

    public void setState(boolean state) {
        this.state = state;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Car car = (Car) o;
        return Objects.equals(brand, car.brand);
    }

    @Override
    public int hashCode() {
        return Objects.hash(brand);
    }

    @Override
    public String toString() {
        return "Car{" +
                "type='" + type + '\'' +
                ", brand='" + brand + '\'' +
                ", carnumber='" + carnumber + '\'' +
                ", seatnum=" + seatnum +
                ", rent=" + rent +
                ", state=" + state +
                '}';
    }
}
